﻿@model Guline.SupportCMS.Models.Object.TemplateHook

@{
    ViewBag.Title = "Create";
    Layout = "~/Views/Shared/v1_admin_layout.cshtml";
    List<Guline.SupportCMS.Models.Object.Category> categorys = (List<Guline.SupportCMS.Models.Object.Category>)ViewBag.Categorys;
}

<h1>
    <a href="@Url.Action("Index", new { ParentID = Request.QueryString["ParentID"] })"><i class="icon-arrow-left-3 fg-darker smaller"></i></a>
    Add new teamplate hook<small class="on-right"> thêm phần nhúng.</small>
</h1>
<div class="clearfix"></div>


@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>TemplateHook</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Enable)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Enable)
            @Html.ValidationMessageFor(model => model.Enable)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Order)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Order)
            @Html.ValidationMessageFor(model => model.Order)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.StyleID, "Style")
        </div>
        <div class="editor-field">
            @Html.DropDownList("StyleID", String.Empty)
            @Html.ValidationMessageFor(model => model.StyleID)
        </div>

        <div class="editor-label">
            Chuyên mục
        </div>
        <div class="editor-field">
            <select id="slItemID" name="ItemID">
                <option value=""></option>
                @foreach (var n in categorys)
                {
                   
                    <option value="@n.ID">@n.Name</option>
                    foreach (var k in n.Childrens)
                    {
                     
                    <option value="@k.ID">-- @k.Name</option>
                       
                    }

                }
            </select>
            @Html.ValidationMessageFor(model => model.ItemID)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Description)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.Description, new { style = "width:100%;height:150px;" })
            @Html.ValidationMessageFor(model => model.Description)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Content)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.Content)
            @Html.ValidationMessageFor(model => model.Content)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.TemplateID, "Template")
        </div>
        <div class="editor-field">
            @Html.DropDownList("TemplateID")
            @Html.ValidationMessageFor(model => model.TemplateID)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.ParentID, "Parent")
        </div>
        <div class="editor-field">

            @Html.DropDownList("ParentID")
            @Html.ValidationMessageFor(model => model.ParentID)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Param1)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Param1)
            @Html.ValidationMessageFor(model => model.Param1)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Param2)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Param2)
            @Html.ValidationMessageFor(model => model.Param2)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Param3)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Param3)
            @Html.ValidationMessageFor(model => model.Param3)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Param4)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Param4)
            @Html.ValidationMessageFor(model => model.Param4)
        </div>

        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}

<script src="~/ckfinder/ckfinder.js"></script>
<script src="~/ckeditor/ckeditor.js"></script>
<script type="text/javascript">
    var ck = CKEDITOR.instances['Content'];
    if (ck)//check if instance exist
    {
        CKEDITOR.remove(ck);
    }

    CKEDITOR.replace('Content', {
        autoGrow_maxHeight: 500,
        height: 600,
        removePlugins: 'resize',
        enterMode: CKEDITOR.ENTER_BR,
        filebrowserBrowseUrl: '/ckfinder/ckfinder.html',
        filebrowserImageBrowseUrl: '/ckfinder/ckfinder.html',
        filebrowserUploadUrl: '/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&amp;type=Files',
        filebrowserImageUploadUrl: '/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&amp;type=Images',
        filebrowserWindowWidth: 800,
        filebrowserWindowHeight: 500,
        fullPage: true,
        allowedContent: true
    });
</script>

    @section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    }
